import React from 'react'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
// import Home from 'containers/home/home'
import AsyncComponent from './asyncComponent'

const routes = [
  // {
  //   path: '/',
  //   component: Home
  // },
  {
    path: '/',
    component: props => AsyncComponent(props, () => import('containers/test/test'))
  },
  {
    path: '/join', // 微职申请
    component: props => AsyncComponent(props, () => import('containers/join/join'))
  },
  {
    path: '/center', // 登录微职中心
    component: props => AsyncComponent(props, () => import('containers/center/center'))
  },
  {
    path: '/about', // 关于我们
    component: props => AsyncComponent(props, () => import('containers/about/about'))
  },
  {
    path: '/projectList', // 项目列表
    component: props => AsyncComponent(props, () => import('containers/projectList/projectList'))
  },
  {
    path: '/addProject', // 添加新的项目
    component: props => AsyncComponent(props, () => import('containers/addProject/addProject'))
  },
  {
    path: '/userCenter', // 用户个人中心
    component: props => AsyncComponent(props, () => import('containers/userCenter/userCenter'))
  },
  {
    path: '/prompt', // 提交项目成功页
    component: props => AsyncComponent(props, () => import('containers/prompt/prompt'))
  },
  {
    path: '/withdrawPrompt', // 提交取现申请成功页
    component: props => AsyncComponent(props, () => import('containers/prompt/withdrawPrompt'))
  },
  {
    path: '/promptSuccess', // 提交微职申请成功页面
    component: props => AsyncComponent(props, () => import('containers/prompt/promptSuccess'))
  },
  {
    path: '/projectDetail', // 项目详情
    component: props => AsyncComponent(props, () => import('containers/projectDetail/projectDetail'))
  },
  {
    path: '/achievement',  // 业绩流水
    component: props => AsyncComponent(props, () => import('containers/achievement/achievement'))
  },
  {
    path: '/withdraw',  // 提现
    component: props => AsyncComponent(props, () => import('containers/withdraw/withdraw'))
  },
  {
    path: '/checkCommission',  // 查看佣金
    component: props => AsyncComponent(props, () => import('containers/checkCommission/checkCommission'))
  },
  {
    path: '/settlementRecord', // 结算记录
    component: props => AsyncComponent(props, () => import('containers/record/settlementRecord'))
  },
  {
    path: '/noneComplete', // 待结算记录
    component: props => AsyncComponent(props, () => import('containers/noneComplete/noneComplete'))
  },
  {
    path: '/complaintRecord', // 客户投诉已扣除记录
    component: props => AsyncComponent(props, () => import('containers/record/complaintRecord'))
  },
  {
    path: '/accuseRecord', // 个人中心客户投诉记录
    component: props => AsyncComponent(props, () => import('containers/record/accuseRecord'))
  },
  {
    path: '/passwordForget', // 忘记密码
    component: props => AsyncComponent(props, () => import('containers/passwordForget/passwordForget'))
  },
  {
    path: '/setUp', // 个人中心跳转到设置手机号、密码页面
    component: props => AsyncComponent(props, () => import('containers/setUp/setUp'))
  },
  {
    path: '/changePhone', // 跳转到修改手机号页面
    component: props => AsyncComponent(props, () => import('containers/changePhone/changePhone'))
  },
  {
    path: '/accountPresent', // 跳转到提现账户页面
    component: props => AsyncComponent(props, () => import('containers/accountPresent/accountPresent'))
  },
  {
    path: '/bindWeChat', // 绑定微信
    component: props => AsyncComponent(props, () => import('containers/bindWeChat/bindWeChat'))
  },
  {
    path: '/bindBankCard', // 绑定银行卡
    component: props => AsyncComponent(props, () => import('containers/bindBankCard/bindBankCard'))
  },
  {
    path: '/bankList', // 开户行列表
    component: props => AsyncComponent(props, () => import('containers/bankList/bankList'))
  },
  {
    path: '/recordPresent', // 提现记录
    component: props => AsyncComponent(props, () => import('containers/record/recordPresent'))
  },
  {
    path: '/saleNecessary', // 销售必备
    component: props => AsyncComponent(props, () => import('containers/record/saleNecessary'))
  },
  {
    path: '/marketingStrategy', // 营销策略
    component: props => AsyncComponent(props, () => import('containers/record/marketingStrategy'))
  },
  {
    path: '/wxMiddle', // 微信中转页面
    component: props => AsyncComponent(props, () => import('containers/wxMiddle/wxMiddle'))
  },
  {
    path: '/withdrawRule', // 提现规则
    component: props => AsyncComponent(props, () => import('containers/rule/withdrawRule'))
  },
  {
    path: '/commissionRule', // 佣金结算规则
    component: props => AsyncComponent(props, () => import('containers/rule/commissionRule'))
  },
  {
    path: '/advise', // 跳转到意见反馈
    component: props => AsyncComponent(props, () => import('containers/advise/advise'))
  },
  {
    path: '/pdfFile1', // 玖里项目简介
    component: props => AsyncComponent(props, () => import('components/pdfFile/pdfFile1'))
  },
  {
    path: '/pdfFile2', // 玖里产品采购合同
    component: props => AsyncComponent(props, () => import('components/pdfFile/pdfFile2'))
  },
  {
    path: '/pdfFile3', // 玖里平台服务合同
    component: props => AsyncComponent(props, () => import('components/pdfFile/pdfFile3'))
  }
]

const RouteConfig = (
  <BrowserRouter>
    <Switch>
      { routes.map((route, index) => {
        return <Route
          key={index}
          path={route.path}
          exact={index === 0}
          component={route.component} />
      })}
    </Switch>
  </BrowserRouter>
)

export default RouteConfig
